┌─────────────────────────────────────────────────────────────────────┐
│ FRONTEND (Vercel) │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌───────────────────┐ │
│ │ Landing │ │ Dashboard│ │ Security │ │ Project/Scan │ │
│ │ Page │ │ + Tools │ │ Settings │ │ Management │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────────┬──────────┘ │
│ └─────────────┴─────────────┴─────────────────┘ │
│ │ HTTPS │
│ ┌────────┴────────┐ │
│ │ APIClient.js │ ← Axios/Fetch + Bearer Token │
│ └────────┬────────┘ │
└───────────────────────────┼─────────────────────────────────────────┘
│
┌───────────────────────────┼─────────────────────────────────────────┐
│ LARAVEL BACKEND API │
│ ┌────────────────────────┴──────────────────────────────┐ │
│ │ API Gateway (routes/api.php) │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌────────┐ │ │
│ │ │ Sanctum │ │ Force │ │ Check │ │Require │ │ │
│ │ │ Auth │ │ JSON │ │ Org │ │ 2FA │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ └────────┘ │ │
│ └───────────────────────────────────────────────────────┘ │
│ │ │
│ ┌────────────────────────┼──────────────────────────────┐ │
│ │ Controllers & Services │ │
│ │ ┌──────┐ ┌──────┐ ┌──────┐ ┌────┐ ┌──────┐ ┌────┐ │ │
│ │ │ Auth │ │ Proj │ │ Scan │ │Targ│ │ Phish│ │Bill│ │ │
│ │ │ │ │ ect │ │ ner │ │et │ │ ing │ │ing │ │ │
│ │ └──────┘ └──────┘ └──────┘ └────┘ └──────┘ └────┘ │ │
│ └───────────────────────────────────────────────────────┘ │
│ │ │
│ ┌────────────────────────┼──────────────────────────────┐ │
│ │ Background │ │
│ │ ┌──────────┐ ┌──────────────┐ ┌────────────────┐ │ │
│ │ │ Queue │ │ Reverb │ │ Docker │ │ │
│ │ │(DB/Redis)│ │ WebSocket │ │ Containers │ │ │
│ │ └──────────┘ └──────────────┘ └────────────────┘ │ │
│ └───────────────────────────────────────────────────────┘ │
│ │ │
│ ┌────────────────────────┴──────────────────────────────┐ │
│ │ Database (MySQL) │ │
│ │ 50+ tables: users, projects, targets, scans, │ │
│ │ findings, phishing_campaigns, organizations, billing │ │
│ └───────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
How Frontend & Backend Communicate
Layer
Technology
Details
API Protocol
RESTful JSON
All communication via https:// endpoints
Authentication
Bearer (Sanctum)
Token issued on login, stored in localStorage, sent as Authorization: Bearer header
2FA Flow
Challenge-Response
Login returns requires_2fa flag → frontend shows code prompt → POST /auth/2fa/verify
Organization Context
Custom Header
X-Organization-Id header injected by frontend for multi-tenant requests
Real-Time Updates
Laravel Reverb WebSocket
Scan progress, findings, and status streamed live via Echo on private channels
Error Handling
Structured JSON
Standardized { status, message, errors } responses + ErrorHandler.js on frontend
Validation
Laravel FormRequest → Frontend
422 errors transformed into [{ field, message }] for inline display
File Uploads
Pre-signed S3 URLs
Evidence files uploaded via signed URLs, never stored on app server
🔐 Authentication & Security
Feature
Details
Authentication
Laravel Sanctum with Bearer tokens, hashed at rest
Two-Factor Auth (2FA)
TOTP via Google Authenticator, QR code setup, enable/disable/verify flow
Google OAuth 2.0
Social login via Laravel Socialite
Email Verification
Signed verification URLs, resend with rate limiting (6/min)
Password Reset
Token-based reset flow with notification emails
Account Lockout
5 failed attempts → 15-minute lockout
Password Hashing
bcrypt with configurable rounds (default 12)
API Key Management
Encrypted-at-rest storage for VirusTotal, AbuseIPDB, Shodan, etc.
🎯 Vulnerability Scanning Engine
Feature
Details
Docker-Based Scanners
Isolated containers per scanner type (subdomain, endpoint, port scan, SQLi, XSS, etc.)
Real-Time Streaming
Terminal logs + findings broadcast via WebSocket (scan.{scanJobId} channel)
Multi-Driver Architecture
10+ scanner drivers across recon, web, and network categories
Scan Orchestrator
Creates ScanJob → dispatches per-module jobs → aggregates results → recalculates risk
Output Normalization
Every scanner outputs structured JSON parsed by OutputNormalizer service
Risk Scoring
CVSS-weighted formula: (Critical × 10 + High × 7 + Medium × 4 + Low × 1) / 100
Finding Lifecycle
open → in_progress → resolved / false_positive / accepted_risk
Evidence Attachments
Screenshots, HTTP request/response pairs, logs — stored in S3 as pre-signed URLs
🎣 Phishing Simulation Platform
Feature
Details
Custom Domains
Register with Brevo API, DNS verification (SPF/DKIM/DMARC)
Phishing Templates
Global pool + custom templates (Password Expiry, HR Doc, Invoice, etc.)
Employee Management
Manual entry + CSV import with department tagging
Campaign Lifecycle
Draft → Schedule → Launch → Real-time tracking
Event Tracking
Sent → Opened (pixel) → Clicked → Credentials Submitted
Awareness Scoring
Per-employee risk score: +2 click, +3 submit, -1 report
Department Analytics
Risk breakdown by department, employee risk ranking, campaign reports
Multi-Channel
Email (Brevo SMTP), SMS, WhatsApp support
Granular Permissions
Owner delegates: templates.manage, campaigns.manage, employees.manage, reports.view
Feature
Details
Multi-Tenancy
Personal workspaces + B2B Organizations
Role-Based Access
Owner, Admin, Editor, Viewer — enforced at Policy level
Project Collaboration
Invite via email or shareable link with 7-day expiry
Organization Management
Corporate email verification, member management, role assignment
Audit Logging
Append-only log of all critical actions (scan.start, finding.resolved, member.invited)
Feature
Details
Tiered Plans
Free / Starter / Pro (Personal) + Starter / Pro / Enterprise (Organization)
Payment Gateway
Paymob (Egyptian EGP) with HMAC-secured webhooks
Usage Quotas
Per-plan limits on projects, targets, scans/month, members — enforced at Policy + DB level
Monthly Reset
Scan counters reset via scheduled Artisan command
Billing Orders
Polymorphic orders for both User and Organization billing
Corporate Verification
Organization identity verified via corporate email or DNS TXT records
Feature
Details
Interactive Dashboard
Security metrics, risk gauges, scan history, finding summaries
Security Tools Arsenal
OSINT, Web Auditing, Threat Intelligence, Cryptography, JWT Debugger, Active Scanners
Real-Time Updates
WebSocket-powered live scan progress and finding streaming
AI Assistant
Autopilot control interface with interactive security chat
Responsive Design
Mobile-first layout with fluid animations and cyber-themed UI
Organization Onboarding
Multi-step workspace setup with payment and identity verification
Documentation Hub
Built-in docs with General, Quick Start, and Testing guides
Category
Technologies
Core
Vanilla JavaScript (ES6+), HTML5, CSS3
Styling
Tailwind CSS 4.0, Custom cyber-themed design system
API Client
Fetch API with APIClient.js (JWT, interceptors, error handling)
Real-Time
Laravel Echo + Reverb WebSocket
Auth
JWT Bearer tokens, 2FA flow, Google OAuth callback handling
State Management
state-manager.js with localStorage persistence
Charts & Gauges
Custom Canvas/SVG risk gauges, performance audit charts
Build Tool
Vite 7 (Laravel bundle)
Deployment
Vercel (serverless static hosting with API rewrites)
Testing
Vitest, jsdom, Happy DOM
Category
Technologies
Framework
Laravel 12 (PHP 8.2+)
Auth
Laravel Sanctum (API tokens), Socialite (Google OAuth)
2FA
pragmarx/google2fa-laravel (TOTP + QR codes via bacon/bacon-qr-code, endroid/qr-code)
Database
MySQL 8+ (primary), SQLite (testing), Database-driven cache/queue/session
WebSocket
Laravel Reverb 1.10 (self-hosted WebSocket server)
Queue
Database-driven (configurable Redis/SQS/Beanstalkd)
Broadcasting
Reverb (Pusher protocol compatible)
Scanners
Docker containers (subfinder, dnsx, nmap, waybackurls, gau, katana, hakrawler)
File Storage
S3-compatible (pre-signed URLs)
Email
Gmail SMTP (system) + Brevo API (phishing)
Payments
Paymob Accept (Egyptian payment gateway)
External APIs
VirusTotal, AbuseIPDB, WhoisXML, Shodan, URLScan, OpenRouter AI
Testing
PHPUnit 11, Mockery, Faker
Security Tools & Integrations
Category
Tools/Services
Reconnaissance
Subdomain Enumeration, WHOIS Lookup, DNS Analysis, IP Geolocation
Web Security
XSS Scanner, SQLi Scanner, Endpoint Fuzzer, HTTP Headers Audit, SSL/TLS Check, CORS Check
Network Security
Port Scanner (Quick/Full/Stealth/UDP), Service Detection, OS Fingerprinting
Threat Intel
VirusTotal, AbuseIPDB, Shodan, URLScan
Cryptography
Multi-Hash Generator (MD5/SHA1/SHA256/SHA512), Password Analyzer, Hash Identifier
Phishing
Brevo Domain Registration, SPF/DKIM/DMARC Verification, Campaign Tracking
cyberguard/ # Backend (Laravel 12)
├── app/
│ ├── Console/Commands/ # Artisan CLI commands
│ ├── Events/ # Reverb WebSocket events
│ ├── Exceptions/ # Domain validation exceptions
│ ├── Http/
│ │ ├── Controllers/ # 25+ API controllers
│ │ ├── Middleware/ # ForceJson, CheckOrg, Require2FA
│ │ └── Requests/ # FormRequest validation
│ ├── Jobs/ # Queueable jobs (scans, emails)
│ ├── Mail/ # Mailable classes
│ ├── Models/ # 25+ Eloquent models
│ ├── Notifications/ # Notification classes
│ ├── Policies/ # 8 authorization policies
│ ├── Rules/ # Custom validation rules
│ ├── Services/ # ScanOrchestrator, Paymob, Brevo, 2FA
│ └── Support/ # SubscriptionPlans, WorkspaceContext
├── config/ # 20+ configuration files
├── database/
│ ├── migrations/ # 50 database migrations
│ ├── factories/ # Model factories (testing)
│ └── seeders/ # Database seeders
├── routes/
│ ├── api.php # All API routes (50+ endpoints)
│ ├── channels.php # WebSocket channel auth
│ └── web.php # Web routes (phishing tracking)
├── scanners/ # Docker scanner modules
│ └── web/
│ ├── sub-domain/ # Subdomain enumeration (Python)
│ ├── endpoint-fuzzer/ # Web endpoint discovery (Bash)
│ └── get-endpoits/ # Endpoint extraction (Bash)
├── tests/ # PHPUnit test suites
│ ├── Feature/ # 2FA auth tests
│ └── Unit/ # Unit tests
└── vendor/
cyberguard-frontend/ # Frontend (GitHub: Tersana/CyberGuard)
├── public/ # Deployed to Vercel
│ ├── index.html # Landing page
│ ├── dashboard.html # Security dashboard
│ ├── login.html # Authentication
│ ├── signup.html # Registration
│ ├── project-detail.html # Project management
│ ├── scan-progress.html # Real-time scan viewer
│ ├── pricing.html # Subscription plans
│ ├── invitation.html # Team invitation handler
│ ├── css/ # Tailwind + custom styles
│ └── js/ # Modular JavaScript (~40 modules)
│ ├── api-client.js # Centralized HTTP client
│ ├── auth.js # AuthManager (JWT, 2FA, sessions)
│ ├── dashboard-integration.js # Dashboard metrics
│ ├── project-manager.js # CRUD operations
│ ├── scan-manager.js # Scan lifecycle
│ ├── phishing.js # Phishing management
│ ├── organization-manager.js # Multi-tenant workspace
│ ├── billing-api.js # Subscription/payment
│ ├── threat-intel.js # VirusTotal, AbuseIPDB
│ ├── osint.js # Reconnaissance tools
│ ├── security-dashboard.js # Metrics & charts
│ └── ...
├── api/ # Vercel serverless functions
│ ├── proxy.js # CORS proxy
│ ├── abuseipdb.js # AbuseIPDB proxy
│ ├── shodan.js # Shodan proxy
│ └── scan/ # Scan proxy endpoints
├── tests/ # Vitest test suite
└── package.json
Driver ID
Name
Category
Access
subdomain-scan
Subdomain Enumeration & Analysis
Reconnaissance
✅ All Users
web-endpoint-fuzzer
Web Endpoint Fuzzer & Classifier
Application Security
✅ All Users
nmap-stealth-scan
Stealth Evasion Scan
Perimeter Evasion
✅ All Users
nmap-os-discovery
Host OS Fingerprinting
Reconnaissance
✅ All Users
sqli
SQL Injection Scanner
Application Security
🔒 Organization Only
xss
XSS Vulnerability Scanner
Application Security
🔒 Organization Only
nmap-quick-scan
Quick Port Scan
Network Security
🔒 Organization Only
nmap-service-vuln
Advanced Service & Vuln Scan
Vulnerability Management
🔒 Organization Only
nmap-full-scan
Full Infrastructure Port Scan
Network Security
🔒 Organization Only
nmap-udp-scan
UDP Service Discovery
Network Security
🔒 Organization Only
The backend exposes 50+ RESTful endpoints across these modules:
Module
Endpoints
Description
Auth
POST /auth/register, POST /auth/login, POST /auth/logout, GET /auth/me, GET /auth/status
Registration, authentication, session management
2FA
POST /auth/2fa/setup, POST /auth/2fa/enable, POST /auth/2fa/verify, POST /auth/2fa/disable
TOTP two-factor authentication
Password
POST /auth/forgot-password, POST /auth/reset-password
Password reset flow
OAuth
GET /auth/google/redirect, GET /auth/google/callback
Google social login
Email
GET /email/verify/{id}/{hash}, POST /email/verification-notification/resend
Email verification
Dashboard
GET /dashboard/metrics
Security metrics overview
Projects
GET/POST/PUT/DELETE /projects
CRUD operations
Targets
GET/POST/PUT/DELETE /projects/{project}/targets
Target management + DNS verification
Scans
POST /scan/start, GET /scan/{id}/status, GET /scan/{id}/findings, POST /scan/{id}/pause/continue/cancel
Full scan lifecycle
Findings
GET/PATCH /findings, POST /targets/{target}/findings
Vulnerability management
Phishing
GET/POST/PUT/DELETE /phishing/*
Campaigns, domains, templates, employees, reports
Organizations
GET/POST/PUT/DELETE /organizations/*
Multi-tenant workspace management
Members
GET/POST/PUT/DELETE /organizations/members/*
Role-based member management
Billing
POST /billing/checkout, GET /billing/orders, GET /billing/plans
Subscription & payments
Profile
PUT /user/profile, POST /user/profile/avatar
User profile management
API Keys
GET/POST/DELETE /apiKeys
Third-party service credentials
Full API documentation is available in routes/api.php .
Layer 1: HTTPS Enforcement → All traffic encrypted in transit
Layer 2: Sanctum Auth → JWT Bearer tokens, hashed at rest
Layer 3: Rate Limiting → 5 auth attempts/15min, 60 API req/min
Layer 4: FormRequest Validation → Input sanitized before controller
Layer 5: Laravel Policies → RBAC enforced server-side
Layer 6: Organization Context → Multi-tenant data isolation
Layer 7: Scanner Sandboxing → Docker containers with read-only FS
Layer 8: Encryption at Rest → AES-256-CBC for sensitive data
Layer 9: Audit Logging → Append-only trail of all actions
Layer 10: CVE Lookup → Automated vulnerability matching
Measure
Implementation
Password Storage
bcrypt with 12 rounds
2FA Secrets
Encrypted at rest (Laravel encrypted cast)
API Tokens
Hashed in database (Sanctum)
Phishing Data
Encrypted array cast on submitted_data
File Storage
Private S3 bucket, pre-signed URLs (1hr validity)
Command Injection
Process::run([array]) never shell_exec(string)
Scanner Isolation
--read-only --no-new-privileges --memory=256m flags
Network Isolation
Docker --internal network (no internet from containers)
Input Validation
Dual layer: Laravel FormRequest + Docker script regex
CORS
Custom middleware, origin whitelisting
Session Security
http_only=true, same_site=lax, 120min lifetime
UUID Primary Keys
Prevents ID enumeration on all resources
# Backend (PHPUnit)
php artisan test
# Frontend (Vitest)
npm test
Test coverage includes:
2FA Authentication Flow — setup, enable, verify during login, disable
Validation Rules — registration, login, profile update
API Error Handling — 401, 403, 422, 429, 500 responses
Feature Tests — role-based access control per endpoint